const mongoose = require('mongoose')
const { preSave } = require('../utils')

const roleSchema = new mongoose.Schema({
    identity: String, // member or admin
    title: String, // 成员 or 管理员
    power: Object,

    meta: {
        createAt: {
            type: Number,
            default: (new Date()).getTime(),
        },
        updateAt: {
            type: Number,
            default: (new Date()).getTime(),
        },
    },
})

roleSchema.pre('save', preSave)
module.exports = roleSchema
